<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input type="text"  v-model.trim="username"
             placeholder="enter the name you search"/>
      <button @click="searchFn">Search</button>
    </div>
  </section>
</template>

<script>
    export default {
        name: "v-search",
        data(){
          return {
            username:""
          }
        },
        methods:{
          searchFn(){
            if(this.username){
              //将username传递给list组件
              this.$bus.$emit("searchFn",this.username)
              //清除用户名
              this.username=""
            }
          }
        }
    }
</script>

<style scoped>

</style>
